package com.hjx.response;

/**
 * <p>Title:响应实体类</p>
 * <p>Description:JSON响应统一使用该类进行响应</p>
 *
 * @author hjx
 * @date 2020/6/9 - 8:42
 */
public class AjaxResponse {
    private int status;
    private String message;
    private Object data;

    public AjaxResponse(){

    }
    public AjaxResponse(ResponseType responseType){
        this.status = responseType.getStatus();
        this.message = responseType.getMessage();
    }
    public AjaxResponse(ResponseType responseType,Object data){
        this.status = responseType.getStatus();
        this.message = responseType.getMessage();
        this.data = data;
    }
    public AjaxResponse(int status,String message,Object data){
        this.status = status;
        this.message = message;
        this.data = data;
    }
    public AjaxResponse(int status,String message){
        this.status = status;
        this.message = message;
    }
    public int getStatus() {
        return status;
    }

    public AjaxResponse setStatus(int status) {
        this.status = status;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public AjaxResponse setMessage(String message) {
        this.message = message;
        return this;
    }

    public Object getData() {
        return data;
    }

    public AjaxResponse setData(Object data) {
        this.data = data;
        return this;
    }

    @Override
    public String toString() {
        return "AjaxResponse{" +
                "status=" + status +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
